package com.simas.common;

import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;
//import net.rim.device.api.ui.container.MainScreen;

public class DeletePolisInfo {
	public DeletePolisInfo() {
		
	}
	
	public void fnDeleteAllPolis() {
		int intDialog = Dialog.ask(Dialog.D_YES_NO, "Hapus Semua Data Login?", Dialog.NO);
		if (intDialog == Dialog.YES) {
			CustomPersistentObject cpo = new CustomPersistentObject();
			cpo.RemovePersistentObject(1);
			cpo.RemovePersistentObject(2);
			cpo.RemovePersistentObject(3);
			cpo.RemovePersistentObject(4);
			cpo.RemovePersistentObject(5);
		}
	}
	
//	public void fnDeleteAllPolis(int intJmlPilihan) {
//		int intDialog = Dialog.ask(Dialog.D_YES_NO, "Hapus Semua Data Login?", Dialog.NO);
//		if (intDialog == Dialog.YES) {
//			CustomPersistentObject cpo = new CustomPersistentObject();
//			for (int a=1; a<=intJmlPilihan-1; a++) {
//				cpo.RemovePersistentObject(a);
//			}
//		}
//	}
	
	public void fnDeletePolis(MainScreen mainScreen, int intIdxScreen) {
		String strQuestion = "Hapus Data Login Simas ";
		if (intIdxScreen == 1) {
			strQuestion = strQuestion + "Sehat?";
		} else {
			strQuestion = strQuestion + "Mobil?";
		}
		int intDialog = Dialog.ask(Dialog.D_YES_NO, strQuestion, Dialog.NO);
		if (intDialog == Dialog.YES) {
			CustomPersistentObject cpo = new CustomPersistentObject();
			cpo.RemovePersistentObject(intIdxScreen);
			OpenLoginScreen ols = new OpenLoginScreen();
			ols.fnOpenLoginScreen(mainScreen, intIdxScreen);
		}
	}
}
